

library(SDMTools)

work.dir = "H:/Barra Work Directory/current.esoclim/"; setwd(work.dir)

mean.temp=NULL

for (ii in 1:12) { cat(ii,'\n')
		tasc.max = read.asc.gz(paste("tasmax", sprintf('%02i',ii), ".asc.gz",sep=''))
		tasc.min = read.asc.gz(paste("tasmin", sprintf('%02i',ii), ".asc.gz",sep=''))
	mean.temp = tasc.max + tasc.min
	mean.temp = mean.temp/2
	
	write.asc.gz(mean.temp, paste(work.dir, "mean.temp", sprintf('%02i',ii),sep=''))
}		 

dev.off()



